package com.lanchetech.admin.controller;

import com.lanchetech.admin.service.AnchorService;
import com.lanchetech.bean.request.AnchorReq;
import com.lanchetech.bean.request.AnchorWindowsReq;
import com.lanchetech.bean.request.DepositReq;
import com.lanchetech.bean.response.BasePageResp;
import com.lanchetech.bean.response.BaseResp;
import com.lanchetech.bean.response.ResultData;
import com.lanchetech.bean.vo.AnchorDepositVO;
import com.lanchetech.bean.vo.AnchorVO;
import com.lanchetech.bean.vo.AnchorWindowsVO;
import com.lanchetech.bean.vo.UserInfoVO;
import com.lanchetech.entity.AnchorDeposit;
import com.lanchetech.entity.UserInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@Api(value = "主播接口", tags = "主播接口")
@RequestMapping("/api/anchor")
@RestController
public class AnchorController {

    @Autowired
    AnchorService anchorService;

    @ApiOperation("获取保证金分页")
    @PostMapping("/getAnchorDepositPage")
    public ResultData<BasePageResp<AnchorDepositVO>> getAnchorDepositPage(@RequestBody DepositReq req) {
        return anchorService.getAnchorDepositPage(req);
    }

    @ApiOperation("审核保证金退款申请")
    @PostMapping("/auditDepositRefund")
    public BaseResp auditDepositRefund(@RequestBody AnchorDeposit req) {
        return anchorService.auditDepositRefund(req);
    }

    @ApiOperation(value = "退款处理回调【微信支付退款回调】")
    @RequestMapping(value = "/refundNotify", method = {RequestMethod.GET, RequestMethod.POST})
    public String refundNotify(@RequestBody String xmlData) {
        return anchorService.refundNotify(xmlData);
    }

    @ApiOperation("获取主播分页")
    @PostMapping("/getAnchorPage")
    public ResultData<BasePageResp<UserInfoVO>> getAnchorPage(@RequestBody AnchorReq req) {
        return anchorService.getAnchorPage(req);
    }

    @ApiOperation("获取主播橱窗商品分页")
    @PostMapping("/getAnchorWindowsPage")
    public ResultData<BasePageResp<AnchorWindowsVO>> getAnchorWindowsPage(@RequestBody AnchorWindowsReq req) {
        return anchorService.getAnchorWindowsPage(req);
    }

}
